import {FractionStyle} from '../types/index'
import {reactive} from 'vue'
let Fraction:FractionStyle = reactive({
  fraction:0,
  Grade:1
})

//加分并且升级
function addFraction(upfraction:number,maxGrade:number){
  //加分
  Fraction.fraction++;
  //判断是否升级
  if(Fraction.fraction % upfraction ==0){
    GradeUp(maxGrade)
  }
}
// 等级提升
function GradeUp(maxGrade:number){
  if(Fraction.Grade<=maxGrade){
    Fraction.Grade++
  }
}

export{
  Fraction,
  addFraction
}